#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const LL MOD=1e9+7;
LL POW(LL a, LL n) {
	LL ret=1;
	while (n) {
		if (n&1) {
			ret=(ret*a)%MOD;
		}
		a=(a*a)%MOD;
		n=(n>>1);
	}
	return ret;
}
int main() {
	LL n;
	cin>>n;
	if (n==0) cout<<0<<endl;
	else if (n==1) cout<<0<<endl;
	else if (n==2) cout<<1<<endl;
	else if (n==3) cout<<6<<endl;
	else cout<<((n%MOD)*((n-1)%MOD)%MOD)*POW(2, n-3)%MOD<<endl;
	return 0;
} 
